﻿using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using GurLoader.View;

namespace GurLoader.GlobalHotkey
{
    [ExcludeFromCodeCoverage]
    public class DefaultWindowsHotkeyProvider : IWindowsHotkeyProvider
    {
        [DllImport("user32", CharSet = CharSet.Ansi,
                   SetLastError = true, ExactSpelling = true)]
        private static extern int RegisterHotKey(IntPtr hwnd,
                int id, int modifiers, int key);

        [DllImport("user32", CharSet = CharSet.Ansi,
                   SetLastError = true, ExactSpelling = true)]
        private static extern int UnregisterHotKey(IntPtr hwnd, int id);

        public int RegisterWindowsHotKey(IntPtr hwnd, int id, int modifiers, int key)
        {
            return RegisterHotKey(hwnd, id, modifiers, key);
        }

        public int UnregisterWindowsHotKey(IntPtr hwnd, int id)
        {
            return UnregisterHotKey(hwnd, id);
        }
    }
}
